#include <algorithm>
#include <cstdio>

typedef long long ll;
const int N = 2e5 + 5, M = 4e5 + 5;
int n, m, q;

struct Graph {
  int e_cnt, heads[N];

  struct Edge {
    int v, nxt, u;
  };

  Edge e[M << 1];

  Graph() : e_cnt(1) {}

  inline void add(int u, int v) {
    e[++e_cnt].v = v, e[e_cnt].nxt = heads[u], heads[u] = e_cnt, e[e_cnt].u = u;
  }
} E, G;

struct Dgraph : Graph {
  inline void add(int u, int v) {
    e[++e_cnt].v = v, e[e_cnt].nxt = heads[u], heads[u] = e_cnt, e[e_cnt].u = u;
    printf("%d %d\n", u, v);
    fflush(stdout);
  }
};

namespace Tarjan {

bool bridge[M << 1];
int cnt, ccid, dfn[N], low[N], cc[N], siz[N];

void tarjan(int x, int fa) {
  dfn[x] = low[x] = ++cnt;
  for (int i = E.heads[x], v; i; i = E.e[i].nxt) {
    if ((v = E.e[i].v) != fa) {
      if (!dfn[v]) {
        tarjan(v, x);
        low[x] = std::min(low[x], low[v]);
        if (low[v] > dfn[x]) { bridge[i] = bridge[i ^ 1] = true; }
      } else
        low[x] = std::min(low[x], dfn[v]);
    }
  }
}

void dfs(int x, int fa) {
  cc[x] = ccid, ++siz[ccid];
  for (int i = E.heads[x], v; i; i = E.e[i].nxt) {
    if (!cc[v = E.e[i].v] && !bridge[i] && v != fa) { dfs(v, x); }
  }
}

}  // namespace Tarjan

namespace TreePat {

int cnt, dfn[N], dep[N], siz[N], top[N], f[N], son[N], cvt[N];

void dfs1(int x) {
  siz[x] = 1;
  for (int i = G.heads[x], v; i; i = G.e[i].nxt) {
    if ((v = G.e[i].v) != f[x]) {
      dep[v] = dep[x] + 1, f[v] = x;
      dfs1(v);
      siz[x] += siz[v];
      if (siz[son[x]] < siz[v]) son[x] = v;
    }
  }
}

void dfs2(int x) {
  dfn[x] = ++cnt, cvt[cnt] = x;
  if (son[x]) top[son[x]] = top[x], dfs2(son[x]);
  for (int i = G.heads[x], v; i; i = G.e[i].nxt) {
    if ((v = G.e[i].v) != f[x] && v != son[x]) {
      top[v] = v;
      dfs2(v);
    }
  }
}

struct Node {
  int sum;
  ll val;
} tr[N << 2];

inline void pushup(int x) {
  tr[x].sum = tr[x << 1].sum + tr[x << 1 | 1].sum;
  tr[x].val = tr[x << 1].val + tr[x << 1 | 1].val;
}

void build(int x, int l, int r) {
  if (l == r)
    return tr[x].sum = Tarjan::siz[cvt[l]],
           tr[x].val = 1ll * tr[x].sum * (tr[x].sum - 1), void();
  int mid = (l + r) >> 1;
  build(x << 1, l, mid);
  build(x << 1 | 1, mid + 1, r);
  pushup(x);
}

ll sumtmp, valtmp;

void query(int x, int l, int r, int L, int R) {
  if (L <= l && r <= R) return sumtmp += tr[x].sum, valtmp += tr[x].val, void();
  int mid = (l + r) >> 1;
  if (L <= mid) query(x << 1, l, mid, L, R);
  if (mid < R) query(x << 1 | 1, mid + 1, r, L, R);
}

ll query(int x, int y) {
  sumtmp = valtmp = 0;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) std::swap(x, y);
    query(1, 1, cnt, dfn[top[x]], dfn[x]);
    x = f[top[x]];
  }
  if (dep[x] < dep[y]) std::swap(x, y);
  query(1, 1, cnt, dfn[y], dfn[x]);
  return sumtmp * (sumtmp - 1) - valtmp;
}

}  // namespace TreePat

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("map.in", "r", stdin);
  freopen("map.out", "w", stdout);
#endif
#endif

  scanf("%d%d%d", &n, &m, &q);
  int u, v;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &u, &v);
    E.add(u, v), E.add(v, u);
  }
  Tarjan::tarjan(1, 1);
  for (int i = 1; i <= n; ++i) {
    if (!Tarjan::cc[i]) ++Tarjan::ccid, Tarjan::dfs(i, i);
  }
  for (int i = 2; i <= E.e_cnt; i += 2) {
    if (Tarjan::cc[E.e[i].u] != Tarjan::cc[E.e[i].v]) {
      G.add(Tarjan::cc[E.e[i].u], Tarjan::cc[E.e[i].v]);
      G.add(Tarjan::cc[E.e[i].v], Tarjan::cc[E.e[i].u]);
    }
  }
  TreePat::top[1] = TreePat::f[1] = TreePat::dep[1] = 1;
  TreePat::dfs1(1);
  TreePat::dfs2(1);
  TreePat::build(1, 1, TreePat::cnt);
  ll ans = 0;
  for (int i = 1; i <= q; ++i) {
    scanf("%d%d", &u, &v);
    ans += TreePat::query(Tarjan::cc[u], Tarjan::cc[v]);
  }
  printf("%lld", ans);
  return 0;
}